import Vue from 'vue'
import Router from 'vue-router'
const HelloWorld = r => require.ensure([], () => r(require('@/components/HelloWorld')), 'home')
const topNav = r => require.ensure([], () => r(require('@/components/nav/topNav')), 'topNav')
const login = r => require.ensure([], () => r(require('@/page/login')), 'login')
const login2 = r => require.ensure([], () => r(require('@/page/login2')), 'login2')
const index = r => require.ensure([], () => r(require('@/page/index')), 'index')
const index2 = r => require.ensure([], () => r(require('@/page/index2')), 'index2')
const orderList = r => require.ensure([], () => r(require('@/page/order/orderList')), 'orderList')
const factoryForm = r => require.ensure([], () => r(require('@/page/factory/factoryForm')), 'factoryForm')
const factoryList = r => require.ensure([], () => r(require('@/page/factory/factoryList')), 'factoryList')
const factoryList2 = r => require.ensure([], () => r(require('@/page/order/factoryList')), 'factoryList')
const orderItem= r => require.ensure([], () => r(require('@/page/order/orderItem')), 'orderItem')
const register= r => require.ensure([], () => r(require('@/page/register')), 'register')

const demoOrderIndex = r => require.ensure([], () => r(require('@/page/project/demo/orderList')), 'demoOrderIndex')
Vue.use(Router)

var routes= [
    {
      path: '/',
      name: 'HelloWorld',
      meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        },
      component: HelloWorld
    },
    {
      path: '/topNav',
      name: 'topNav',
      meta: {
            requireAuth: false,  // 添加该字段，表示进入这个路由是需要登录的
        },
      component: topNav
    },
        {
      path: '/login',
      name: 'login',
      	meta: {
            requireAuth: false,  // 添加该字段，表示进入这个路由是需要登录的
        },
      component: login
    },
     {
      path: '/login2',
      name: 'login2',
//    	meta: {
//          requireAuth: false,  // 添加该字段，表示进入这个路由是需要登录的
//      },
      component: login2
    },
    {
      path: '/register',
      name: 'register',
//    	meta: {
//          requireAuth: false,  // 添加该字段，表示进入这个路由是需要登录的
//      },
      component: register
    },
    {
      path: '/index',
      name: 'index',
      meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        },
      component: index
    },
    {
      path: '/index2',
      name: 'index2',
//    meta: {
//          requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
//      },
      component: index2
    },
    {
      path: '/orderList',
      name: 'orderList',
      meta: {
            requireAuth: false,  // 添加该字段，表示进入这个路由是需要登录的
        },
      component: orderList
    },
    {
      path: '/demoOrderIndex',
      name: 'demoOrderIndex',
      meta: {
            requireAuth: false,  // 添加该字段，表示进入这个路由是需要登录的
        },
      component: demoOrderIndex
    },
    {
      path: '/factoryList',
      name: 'factoryList',
      meta: {
            requireAuth: false,  // 添加该字段，表示进入这个路由是需要登录的
        },
      component: factoryList
    },
    {
      path: '/factoryForm',
      name: 'factoryForm',
      meta: {
            requireAuth: false,  // 添加该字段，表示进入这个路由是需要登录的
        },
      component: factoryForm
    },
       {
      path: '/orderItem',
      name: 'orderItem',
      meta: {
            requireAuth: false,  // 添加该字段，表示进入这个路由是需要登录的
        },
      component: orderItem
    }
  ];



export default new Router({
  routes:routes
})

